using System;
using System.Collections;
using DoDove;
using Script;
using UnityEngine;

public class GameBoot : MonoBehaviour
{
    public static GameBoot Instance { get; private set; }

    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
            return;
        }

        Instance = this;
        DontDestroyOnLoad(gameObject);
    }


    private IEnumerator Start()
    {
        yield return InitFrameworkAndKit();
        yield return InitPool();
    }

    private IEnumerator InitFrameworkAndKit()
    {
        yield return null;
        ResKit.Instance.InitResKit();
        yield return null;
        GameConfigKit.Instance.InitGameConfigKit();
        yield return null;
        TileMapKit.Instance.InitTileMapKit();
        yield return null;
        CameraManager.Instance.SwitchCamera<GameplayCameraHandler>("GameplayCamera");
    }

    private IEnumerator InitPool()
    {
        yield return null;
        PoolTest.RegisterPool();
    }

    private void Update()
    {
        CameraManager.Instance.MoveTargetObj();
    }
}